package com.ddf.pluto.controller;

import com.alibaba.fastjson.JSON;
import com.ddf.publics.service.BidService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: dingding-financial
 * @description: 后台主页饼图
 * @author: Mr.pluto
 * @create: 2020-07-02 19:38
 **/
@Controller
@RequestMapping("backStage")
public class BackstageController {
    @Resource
    private BidService bidService;

    @RequestMapping("/bidPieChart")
    @ResponseBody
    public String bidPieChart(){
        List<Map> list = this.bidService.bidPieChart();
        //标题
        List titleList = new ArrayList();
        list.forEach(m->{
            titleList.add(m.get("name"));
        });
        Map map = new HashMap();
        map.put("title",titleList);
        map.put("list",list);
        return JSON.toJSONString(map);
    }
}
